-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The startup time of xdu with big du outputs is longer than it needs to be, because the tree is kept sorted while inserting new nodes. Because of the locality of "du", we are likely to get paths with the same prefix in order (e.g. "/a/b/c/x","/a/b/c/y", "/a/b/c"). Each path is split into its components ("a","b",...) and these are seached for in the tree to find the correct parent to insert the new node. This search can greatly be reduced, if we insert new nodes as the first child of the parent, because we are very likely to search for exactly this component when we process the next entry. Always add new nodes as first child of the parent node, sort the tree once after the initial build. Performance comparison ====================== This was done with a relative small data file (144857 lines) and includes just the startup time (xmainloop disabled). Before this commit: 368.781008 task-clock (msec) # 0.728 CPUs utilized 24 context-switches # 0.065 K/sec 1 cpu-migrations # 0.003 K/sec 14561 page-faults # 0.039 M/sec 1345388200 cycles # 3.648 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 2267580465 instructions # 1.69 insns per cycle 527033055 branches # 1429.122 M/sec 1899345 branch-misses # 0.36% of all branches 0.506452004 seconds time elapsed After this commit: 162.493654 task-clock (msec) # 0.546 CPUs utilized 28 context-switches # 0.172 K/sec 0 cpu-migrations # 0.000 K/sec 14567 page-faults # 0.090 M/sec 591784363 cycles # 3.642 GHz <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend 1155878943 instructions # 1.95 insns per cycle 258056988 branches # 1588.105 M/sec 1570485 branch-misses # 0.61% of all branches 0.297396523 seconds time elapsed
This function has been obsoleted by the previous commit. Remove it.
Use "static" functions where possible to give the compiler more freedom for optimizations.
Revert the timer based redraw prevention, because we want to take a new approach based on an idle worker. This reverts commit 99a44dd.
A resize triggers an Expose event and we are going to handle changed windows sizes there. So remove resize callback.
Add a function which will register a (Idle-) work procedure to do the redraw when there are no more other events pending. If the window size has changed after the last redraw, clear the window to clean up wrongly scaled relicts.
Instead of doing a repaint on every Expose event, just trigger the work procedure to do a repaint when the queue is idle.
Remove the now obsolete function.
57e45bf
to
1b83466
Compare
fine, redraws like a boss. tested on zoophobie. |
Sign in
to join this conversation on GitHub.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make (some) performance improvements.
Main feature: Redundant redraws are avoided.
This makes xdu usable for big files, too. (Fixed #21)